<template>
  <basic-container>
    <avue-crud
        v-if="tableOption"
        v-bind="bindVal"
        v-on="onEvent"
        v-model:page="page"
        v-model="startForm">
      <template slot="menuLeft">
        <el-button type="primary" @click="downloadTemplate()" size="small">下载导入模板</el-button>
        <el-button type="primary" @click="exportExcel()" size="small">导出</el-button>
      </template>
      <template #menu="{type,size,row}">
        <el-button icon="el-icon-check" link @click="handlerDictionaryItem(row)" :size="size" :type="type">字典项
        </el-button>
      </template>
    </avue-crud>


  </basic-container>
</template>

<script>

import {createDynamicMixin} from "@/mixins/startCrud.js"
import dictionaryOption from "@/option/sys/dictionaryOption"
import * as dictionaryApi from "@/api/sys/dictionaryApi"
import autoRouter from "./autoRouter"


const crudOption = {name: "sys/dictionary"}
crudOption.option = dictionaryOption
crudOption.api = dictionaryApi
crudOption.permissionBtnHandler = {
  delBtn: (vm, row, defaultValue) => {
    return !row.sysFlag;
  }
}
export default {
  mixins: [createDynamicMixin(crudOption)],
  components: {},
  methods: {
    handlerDictionaryItem(row) {
      let params = {}
      params.label = "字典项【" + row.dictName + "】";
      params.dictCode = row.dictCode
      params.dictName = params.label
      this.$router.push({name: autoRouter.names.pageDictItem, params})
    },

  }
}


</script>

<style scoped>

</style>
